package common

import (
	"common/mildware"
	"common/router"
	"github.com/gin-gonic/gin"
	"video/pkg/dao/mysql"
	"video/pkg/dao/redis"
)

type CRouter struct {
}
type CHandler struct {
	R redis.Redis
	M mysql.Mysql
}

func init() {
	router.AddRouter(new(CRouter))
}
func NewCHandler() CHandler {
	return CHandler{M: mysql.NewMysql(), R: redis.NewRedis()}
}
func (CRouter) Router(e *gin.Engine) {
	handler := NewCHandler()
	common := e.Group("/v1/common")
	common.GET("/checkImg", handler.GetCheckImg)
	common.POST("/checkToken", handler.CheckToken)
	common.POST("/video/type/all", handler.GetAllVideoType)
	common.Use(mildware.JWTAuthMiddleware())
	common.POST("/video/type/add", handler.AddVideoType)
	common.POST("/video/type/update", handler.UpdateVideoType)
	common.POST("/video/type/delete", handler.DeleteVideoType)
}
